package com.zs.user.web;

import com.zs.user.pojo.User;
import com.zs.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @projectName: hmall-parent
 * @package: com.zs.user.web
 * @className: UserController
 * @author: zs
 * @description:
 * @date: 2023/5/12 22:19
 * @version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    /**
     * 路径： /user/110
     *
     * @param id 用户id
     * @return 用户
     */
    @GetMapping("/{id}")
    public User queryById(@PathVariable("id") Long id,
                          @RequestHeader(value = "Truth",required = false) String name) {
        System.out.println("请求头中携带的name=======>"+name);
        return userService.queryById(id);
    }

}
